package com.pimee.service.admin.impl;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageInfo;
import com.pimee.common.util.DateUtil;
import com.pimee.mapper.ext.ExtSysNoticeMapper;
import com.pimee.model.SysNotice;
import com.pimee.service.BaseService;
import com.pimee.service.admin.ISysNoticeService;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Service
public class SysNoticeService extends BaseService<SysNotice> implements ISysNoticeService {

	@Autowired
	private ExtSysNoticeMapper extSysNoticeMapper;

	@Override
	public PageInfo<SysNotice> pageList(Map<String, Object> params) {
		log.info("===> 通知列表分页查询...");
		startPage(params);// 设置分页
		List<SysNotice> list = extSysNoticeMapper.pageList(params);
		return new PageInfo<>(list);
	}
	
	@Override
	public void insertNotice(SysNotice param) {
		Date now = DateUtil.now();
		param.setCreateTime(now);
		param.setUpdateTime(now);
		this.saveNotNull(param);
	}

	@Override
	public void updateNotice(SysNotice param) {
		param.setUpdateTime(DateUtil.now());
		this.updateNotNull(param);
	}

}
